<style>
ul.posts {
    list-style-type: none;
    padding: 0px;
    margin: 16px 0px 0px 0px;
    border-top: 1px solid #e0e0e0;
}
ul.posts li.post {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
}
ul.posts li.post:hover {
    background-color: #f0f0f0;
}
div.post-date {
    float: right;
}
div.post-author {
    font-weight: bold;
}
div.post-thumbnail {
    position: absolute;
}
div.post-content {
    margin-left: 48px;
    min-height: 48px;
}
div.post-footer {
    text-align: right;
}

div.flask-pagedown-preview h1 {
    font-size: 140%;
}
div.flask-pagedown-preview h2 {
    font-size: 130%;
}
div.flask-pagedown-preview h3 {
    font-size: 120%;
}
.post-body h1 {
    font-size: 140%;
}
.post-body h2 {
    font-size: 130%;
}
.post-body h3 {
    font-size: 120%;
}
</style>

<ul class="posts" style="width: 75%; ">
    {% for post in posts %}
    <li class="post" style="background-color: #f5f7f5">
        <div class="post-thumbnail" >
            <a href="{{ url_for('.user', username=post.author.username) }}">
                <img class="img-rounded profile-thumbnail" src="{{ post.author.gravatar(size=40) }}">
            </a>
        </div>
        <div class="post-content" >
            <div class="post-date">{{ moment(post.timestamp).fromNow() }}</div>
            <div class="post-author"><a href="{{ url_for('.user', username=post.author.username) }}">{{ post.author.username }}</a></div>
            <div class="post-body">
                {% if post.body_html %}
                    {{ post.body_html | safe }}
                {% else %}
                    {{ post.body }}
                {% endif %}
            </div>
            <div class="post-footer" >
                <a href="{{ url_for('.post', id=post.id) }}">
                    <span class="label label-default">文章链接</span>
                </a>

            {% if current_user == post.author %}
            <a href="{{ url_for('.edit', id=post.id) }}">
                <span class="label label-primary">编辑</span>
            </a>
            {% elif current_user.is_administrator() %}
            <a href="{{ url_for('.edit', id=post.id) }}">
                <span class="label label-danger">编辑[Admin]</span>
            </a>
            {% endif %}
            </div>
        </div>
    </li>
    {% endfor %}
</ul>

